<?php
namespace app\mini_api\controller;
use Qiniu\Auth;
use Qiniu\Config;
use Qiniu\Storage\BucketManager;
use Qiniu\Storage\UploadManager;
class Qiniu extends Permission
{
    public function getToken()
    {
        $config = \config('qiniu'); //获取配置信息
        $accessKey = $config['accessKey'];
        $secretKey = $config['secretKey'];
        $auth = new Auth($accessKey, $secretKey);
        $bucket = $config['bucket'];
        // 生成上传Token
        $token = $auth->uploadToken($bucket);

        $res = [
            'uploadUrl' => 'https://upload-z2.qiniup.com',
            'imgUrl' => 'http://yc.images.zrjt4000602666.com/',
            'token' => $token
        ];

        $this->resSuc($res);

    }

}
